package autowire;

import autowire.bean.Student;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        byName();
        byType();
        byConstructor();
    }

    private static void autowire(String studentName) {
        final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("autowire\\xml\\beans.xml");
        final Student student = (Student) context.getBean(studentName);
        System.out.println(student);
    }

    private static void byName() {
        autowire("student1");
    }
    private static void byType() {
        autowire("student2");
    }
    private static void byConstructor() {
        autowire("student3");
    }

}
